<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateRolesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('store_id')->default(0)->comment('店铺id');
            $table->string('title', 100)->default('')->comment('角色名称');
            $table->string('describe', 100)->default('')->comment('描述');
            $table->tinyInteger('status')->default(1)->comment('角色状态，1正常，0禁用');
            $table->text('half_menu_ids')->comment('角色对应菜单'); // 角色半选中菜单 也是其菜单
            $table->text('menu_ids')->comment('角色对应菜单'); // 用户菜单应该为这两个字段的和
            $table->text('rule_ids')->comment('角色对应权限');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `roles` comment '角色表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('roles');
    }
}
